<%@page import="queenb.web.controller.QueenbController"%>
<%@page import="queenb.net.entitybean.A000"%>
<%@page import="queenb.web.session.LoginSession"%>
<%@page import="queenb.web.controller.LoginCon"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<%@taglib prefix="rich" uri="http://richfaces.org/rich" %>
<%@taglib prefix="a4j" uri="http://richfaces.org/a4j" %>

<f:view locale="en">
    <f:loadBundle basename="#{environmentSession.localizationSource}" var="locale"/>
    <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
            <title>SaiGon-Travel</title>
            <script type="text/javascript" language="javascript" src="../scripts/jQuery/jquery-1.7.2.min.js"></script>   
            <link href="../images/favicon.ico" type="image/x-icon" rel="shortcut icon"/>   
            <link href="../../css/style.css" type="text/css" rel="stylesheet" />


            <script type="text/javascript" language="javascript" src="../scripts/jQuery/kapi.js" charset="utf-8"></script>
            <script type="text/javascript" language="javascript" src="../scripts/jQuery/jquery.fancybox-1.3.4.pack.js"></script>
            <script type="text/javascript" language="javascript">
                var open_cur = 0;
                $j = jQuery.noConflict();
                function chekLogin(){
                    username  =$j('.username').val();
                    password =$j('.password').val();
                    if(username.length < 4){
                        return false;
                    }else if(password.length < 4){
                        return false;
                        //  $j('.errorInfo2').text('PASSWORD KHÔNG HỢP LỆ !');
                    }else{
                        return true;
                        $j('.errorInfo2').text('');
                    }
                    
                }
                $j(document).ready(function(){
                    $j(".keypress").live("keypress",function(e){
                        if(e.which == 13) {
                       
                  
                            $j(this).blur();
                            $j('.submit').focus().click();
                        
                       
                        }

                    });
                    $j(function (e) {
                        if(e.which == 13) {
                      
                            $('.submit').click();
                        } 
                    }  );
             
                    $j(function () {
                        $j.getJSON("http://jsonip.appspot.com?callback=?", DisplayIP);
                    });
                    function DisplayIP(response) {

                        $j(".ipadress").attr('value',response.ip)
 
                    };
                });
            </script>

            <style  type="text/css">


                .loginform{
                    background: url("../images/login.png") no-repeat scroll 0 0 transparent;
                    height: 280px;
                   margin-left: 35%;
                    margin-top: 122px;
                    position: relative;
                    width: 401px;
                }
                .username{
                    float: left;
                    height: 23px;
                    margin-left: 137px;
                    margin-top: 99px;
                    width: 220px !important;
                }
                .password{
                    height: 23px;
                    margin-left: 137px;
                    margin-top: 12px;
                    width: 220px !important;  
                    float:left;

                }
                .actionlogin{
                    float: left;
                    height: 27px;
                    margin-left: -74px;
                    margin-top: 62px;
                    width: 73px;

                }
                .errorInfo{
                    color:#fff;
                    float:left;
                    margin-top:45px;
                    margin-left:30px;
                    text-transform: uppercase;

                }
                .errorInfo2{
                    color:#fff;
                    float:left;
                    margin-top:45px;
                    margin-left:30px;
                    text-transform: uppercase;
                }
            </style>
        </head>

        <body>
            <div id="main">

                <!--Content-->
                <div id="container">
                    <div id="login">
                        <div class="login hide" style="min-height: 100px">
                           
                            <a4j:form id="LOGIN">
                               
                                <div class="loginform">
                                    <h:inputText id="USERNAME"  value="#{loginCon.userName}"  styleClass="username keypress" required="true" style="width:170px;"/>                                       

                                    <h:inputSecret id="PASSWORD" styleClass=" password keypress"
                                                   required="true" 
                                                   value="#{loginCon.password}" style="width:170px;">
                                        <a4j:support event="onblur"></a4j:support>
                                    </h:inputSecret>
                                    <a4j:commandLink onclick="showPleaseWait();" oncomplete="hidePleaseWait();" id="submitCommandButton"   type="submit" styleClass="submit actionlogin" value=""
                                                     action="#{loginCon.checkLogin}">
                                    </a4j:commandLink> 
                                    <center>
                                        <rich:messages globalOnly="true"  styleClass="errorInfo" id="message" ajaxRendered="true"></rich:messages>
                                        </center>
                                    </div>

                            </a4j:form>
                        </div>



                    </div>
                </div>
                <!--End Content-->
            </div>
            <rich:modalPanel id="ajaxLoadingModalBox" minHeight="30" minWidth="40"
                             height="30" width="40" zindex="2000" >
                <h:outputText value="Please wait" styleClass="startDummer"></h:outputText>
            </rich:modalPanel>
            </div>

        </body>
    </html>

</f:view>

